import time
import threading


def sing(p):
    for i in range(5):
        time.sleep(0.5)
        print(p + "演唱歌曲")


def dance(p):
    for i in range(5):
        time.sleep(0.5)
        print(p + "随风舞蹈")


# 单线程使用了5秒完成了2个任务
# sing()
# dance()
# 两个线程时一共用了2.5秒
t1 = threading.Thread(target=sing, args=("小红",))
t2 = threading.Thread(target=dance, args=("小明",))
t1.start()
t2.start()
